package cn.pconline.autoclub.entity;

import org.gelivable.dao.Column;
import org.gelivable.dao.Entity;
import org.gelivable.dao.Id;
import org.gelivable.dao.Label;

import cn.pconline.autoclub.util.EncodeUtils;

import com.alibaba.fastjson.JSONObject;

/**
 * 
 * @author fgs
 * 活动图片表
 */
@Entity(tableName = "ac_activity_pic")
public class ActivityPic {
	
	@Id
	@Label("图片ID")
    @Column(name = "pic_id")
	private long picId;
	
	@Label("活动ID")
    @Column(name = "activity_id")
	private long activityId;
	
	@Label("图片地址")
	private String url ;
	
	@Label("图片宽度")
	private int width;
	
	@Label("图片高度")
	private int height;
	
	@Label("顺序")
	private int seq;
	
	@Label("图片描述")
	@Column(name = "description")
	private String description;
	/**排序 ---升序**/
	public static final String ORDER_ASC = "asc";
	/**排序 ---倒序**/
	public static final String ORDER_DESC = "desc";
	
	
	
	public long getPicId() {
    	return picId;
    }

	public void setPicId( long picId ) {
    	this.picId = picId;
    }

	public long getActivityId() {
    	return activityId;
    }

	public void setActivityId( long activityId ) {
    	this.activityId = activityId;
    }

	public String getUrl() {
    	return url;
    }

	public void setUrl( String url ) {
    	this.url = url;
    }

	public int getWidth() {
    	return width;
    }

	public void setWidth( int width ) {
    	this.width = width;
    }

	public int getHeight() {
    	return height;
    }

	public void setHeight( int height ) {
    	this.height = height;
    }

	public int getSeq() {
    	return seq;
    }

	public void setSeq( int seq ) {
    	this.seq = seq;
    }
	
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public JSONObject toJson(){
		JSONObject jsonObject = new JSONObject();
		jsonObject.put("url",getUrl());
		jsonObject.put("width", getWidth());
		jsonObject.put("height", getHeight());
		jsonObject.put("description", description);
		return jsonObject;
	}
	
	public JSONObject toJsonEncodeHTML(){
		JSONObject jsonObject = new JSONObject();
		jsonObject.put("url",EncodeUtils.encodeForHTMLFilterNull(getUrl()));
		jsonObject.put("width", getWidth());
		jsonObject.put("height", getHeight());
		jsonObject.put("description", EncodeUtils.encodeForHTMLFilterNull(description));
		return jsonObject;
	}
	
	
}
